//
//  NetConnectView.m
//  XMLY
//
//  Created by lanou on 15/11/7.
//  Copyright © 2015年 曾杰. All rights reserved.
//

#import "NetConnectView.h"

@interface NetConnectView ()
@property (nonatomic, strong) UIImageView *netImageView;
@property (nonatomic, strong) UILabel *warningLabel;
@property (nonatomic, strong) UILabel *descLabel;
@end
@implementation NetConnectView
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor whiteColor];
        _netImageView = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 40, 100, 80, 80)];
        _netImageView.image = [UIImage imageNamed:@"wuxinhao"];
        [self addSubview:_netImageView];
        
        _warningLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 50, 200, 100, 30)];
        _warningLabel.font = [UIFont systemFontOfSize:22];
        _warningLabel.text = @"无网络";
        _warningLabel.textAlignment = NSTextAlignmentCenter;
        [self addSubview:_warningLabel];
        
        _descLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH / 2 - 125, 240, SCREEN_WIDTH - 100, 30)];
        _descLabel.alpha = 0.5;
        _descLabel.text = @"请检查手机是否联网，点击按钮重新加载";
        _descLabel.textAlignment = NSTextAlignmentCenter;
        _descLabel.font = [UIFont systemFontOfSize:14];
        [self addSubview:_descLabel];
        
        _retryBtn = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _retryBtn.frame = CGRectMake(SCREEN_WIDTH / 2 - 50, 310, 100, 40);
        [_retryBtn setTitleColor:[UIColor blackColor] forState:(UIControlStateNormal)];
//        _retryBtn.backgroundColor = [UIColor redColor];
        _retryBtn.layer.cornerRadius = 5.0;
        _retryBtn.layer.borderWidth = 1.0;
        _retryBtn.layer.borderColor = [[UIColor lightGrayColor] CGColor];
        
        _retryBtn.layer.masksToBounds = YES;
        [_retryBtn setTitle:@"重新加载" forState:(UIControlStateNormal)];
        [self addSubview:_retryBtn];
        
    }
    return self;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
